package ar.org.cfired.creditos;
import org.jbpm.api.Configuration;
import org.jbpm.api.NewDeployment;
import java.util.Date;
import java.io.File;

	public class DeployProcess {
		
		/**
		 * @param args
		 */
		public static void main(String[] args) {
			
			 //Para borrar deploys
			/*
			for (int i =330; i<331; i++) {
				try{new Configuration().buildProcessEngine().getRepositoryService().deleteDeploymentCascade(String.valueOf(i));}
				catch (Exception e) {}
			}
				System.exit(0);
			*/
			
			
			
			
			NewDeployment deployment = new Configuration().buildProcessEngine().getRepositoryService().createDeployment();
									   
/*			new Configuration().buildProcessEngine().getRepositoryService().deleteDeployment("11");
			new Configuration().buildProcessEngine().getRepositoryService().deleteDeployment("12");
			new Configuration().buildProcessEngine().getRepositoryService().deleteDeployment("13");
			new Configuration().buildProcessEngine().getRepositoryService().deleteDeployment("14");
			new Configuration().buildProcessEngine().getRepositoryService().deleteDeployment("11");
			*/ 
			//File f = new File("C:/workspace-mvn/creditos-mvn/src/main/resources/processdefinition.jpdl.xml");
			//deployment.addResourceFromFile(f);
			deployment.addResourceFromClasspath("processdefinition.jpdl.xml");
			deployment.addResourceFromClasspath("processdefinition.png");
			/*deployment.addResourceFromClasspath("ar/org/cfired/creditos/inicio.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ActuacionesRechazo.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ActuacionesViables.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/AltaExpediente.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/AnalisisActuacion.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/AnalisisViabilidad.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/AprobacionFider.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/AprobacionSecGral.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/completarDatos.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ControlFormal.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/DesigSectorialista.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/EsperaBanco.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/elevacion.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/FormulacionDeProyecto.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/FormulacionDeProyectoVista.ftl");
											//	/ar/org/cfired/creditos/RecepcionCFI.ftl
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/RecepcionCFI.ftl");			
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ResolucionAnalisis.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ResolucionCreditos.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ResolucionIntervenc.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ResolucionLegales.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/ResolucionRecFin.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/RespuestaExcepcion.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/SolicitudExcepcion.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/SolicitudRechazada.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/SolicitudRecibida.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/creditos/SolicitudSuspendida.ftl");
			
			*/
			 
			//deployment.addResourceFromClasspath("ar/org/cfired/creditos/frmsolicitudimpr.js");
			//deployment.addResourceFromClasspath("ar/org/cfired/creditos/LogoCFI.gif");
			/*			deployment.addResourceFromClasspath("ar/org/cfired/taskform/request_vacation.ftl");
			deployment.addResourceFromClasspath("ar/org/cfired/taskform/verify_request.ftl");*/
			deployment.setName("Creditos v1.0.6");
			deployment.setTimestamp(new Date().getTime());
			deployment.deploy(); 
			
			System.out.println("Listo!"); 
		}

	}

